import sys
import numpy as np
import matplotlib.pyplot as plt
y_file = sys.argv[1]
par_file = sys.argv[2] + y_file
t = int(sys.argv[3])
with open(y_file , "r" , encoding = "utf-8") as file:
    y = [float(line.strip()) for line in file if line.strip()]
with open(par_file , "r" , encoding = "utf-8") as file:
    par = [float(line.strip()) for line in file if line.strip()]
def fun(x,y,t):
    res = 0.0
    for i in range(t+1):
        res += par[i]*(x**i)
    return res
x = [i for i in range(-99,100)]
real_y = [fun(i,y,t) for i in x]
plt.scatter(x,y[0:199],label = "real values",color = 'red',s = 5)
plt.plot(x,real_y,label = "theoritical values",color = 'blue')
way = par_file[0:2]
plt.title(f"method:{way}")
plt.show()
